<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%meetapply}}".
 *
 * @property string $ma_id
 * @property string $ma_content
 * @property string $ma_meetname
 * @property integer $ma_countpeople
 * @property string $ma_department
 * @property string $ma_starttime
 * @property string $ma_endtime
 * @property string $ma_speaker
 * @property string $ma_createtime
 * @property string $ma_type
 * @property string $ma_loginstatus
 * @property string $ma_applystatus
 * @property string $ma_meetaddress
 * @property string $ma_feedback
 */
class Meetapply extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%meetapply}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['ma_content', 'ma_meetname', 'ma_countpeople', 'ma_department', 'ma_starttime', 'ma_endtime', 'ma_speaker', 'ma_type','ma_createtime'], 'required'],
            [['ma_content', 'ma_type'], 'string'],
            [['ma_countpeople'], 'integer'],
            [['ma_meetname','ma_speaker'], 'string', 'max' => 60],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ma_id' => Yii::t('common','会务编号'),
            'ma_content' => Yii::t('common','会务内容'),
            'ma_meetname' => Yii::t('common','会务名'),
            'ma_countpeople' => Yii::t('common','人数'),
            'ma_department' => Yii::t('common','参会部门'),
            'ma_starttime' => Yii::t('common','开始时间'),
            'ma_endtime' => Yii::t('common','结束时间'),
            'ma_speaker' => Yii::t('common','讲师'),
            'ma_createtime' => Yii::t('common','创建时间'),
            'ma_type' => Yii::t('common','类型'),

            'ma_loginstatus' => Yii::t('common','状态'),
            'ma_applystatus' => Yii::t('common','审核'),
            'ma_meetaddress' => Yii::t('common','地点'),
            'ma_feedback' => Yii::t('common','反馈'),
            'ma_mid' => Yii::t('common','发起人'),
        ];
    }

    public function name($ma_mid = null){
        $connection  = Yii::$app->db;
        $sql = "SELECT * FROM mly_user WHERE id=".$ma_mid;
        $command = $connection->createCommand($sql);
        // $status = $command->execute();
        $status = $command->queryAll();
        return $status;
    }
}
